package com.wyl.clinic.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.common.collect.Lists;
import com.wyl.clinic.entity.Doctor;
import com.wyl.clinic.entity.Patient;
import com.wyl.clinic.mapper.DoctorMapper;
import com.wyl.clinic.model.DoctorVo;
import com.wyl.clinic.service.DoctorService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 医生表 服务实现类
 * </p>
 *
 * @author wangyulong
 * @since 2024-02-20
 */
@Service
public class DoctorServiceImpl extends ServiceImpl<DoctorMapper, Doctor> implements DoctorService {

    @Override
    public List<Doctor> listByUserIds(List<Integer> userIds) {
        if (ObjectUtil.isEmpty(userIds)) return Lists.newArrayList();
        LambdaQueryWrapper<Doctor> wrapper = new LambdaQueryWrapper<>();
        wrapper.in(Doctor::getUserId, userIds);
        return this.baseMapper.selectList(wrapper);
    }

    @Override
    public List<Doctor> listByVo(DoctorVo doctorVo) {
        return this.baseMapper.listByVo(doctorVo);
    }
}
